package com.design.proxy;


import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @author ytj
 * @date 2024/11/28 11:26
 */
@Slf4j
public class ProxyHandler implements InvocationHandler {
    private ProxyService proxyService;

    public ProxyHandler(ProxyService proxyService){
        this.proxyService=proxyService;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        log.info("执行动态代理");
        return method.invoke(proxyService,args);
    }
}
